﻿using System;
using System.Web.UI.WebControls;
using BONSAI.BLL;

namespace BONSAI.Admin.UC
{
    public partial class AboutUsManagement : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindStart();
            }
        }
        public void BindStart()
        {
            //// delete all
            if (Request.QueryString["zxc"] != null)
            {
                if (Request.QueryString["zxc"] == "1qwertyuiop")
                {
                    //se.AboutUs_Delete(0);
                }
            }
            ////=============

            //==========================
            var table = (new AboutUsBO()).GetAll();
            GridView1.DataSource = table;
            GridView1.DataBind();
        }

        protected void lbcreate_Click(object sender, EventArgs e)
        {
            Response.Redirect("AboutUsUpdate.aspx");
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            BindStart();
        }

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (GridView1.DataKeys != null)
            {
                var key = GridView1.DataKeys[e.RowIndex].Value.ToString();
                (new AboutUsBO()).DeleteByID(key);
            }
            BindStart();
        }
    }
}